<!DOCTYPE html>
Tests fast animating gif (10ms per frame). Passes if it doesn't crash.<br>
<img src="resources/animated-10color-fast.gif">
<script src="../resources/run-after-layout-and-paint.js"></script>
<script>

// Busy-wait 50ms to trigger the bug of invalidation during paint.
// The busy-waiting (as opposed to setTimout) is intentional, in order to
// block the thread.
function delay() {
  var startTime = new Date().getTime();
  while (new Date().getTime() - startTime < 50);
}

var count = 3;

function displayOneFrame() {
  delay();
  if (--count >= 0)
    runAfterLayoutAndPaint(displayOneFrame);
  else
    testRunner.notifyDone();
}

if (window.testRunner) {
  testRunner.dumpAsText();
  testRunner.waitUntilDone();
  displayOneFrame();
}

</script>
